<template>
	<view class="cardstyle">
		<text class="titlebox">{{title}}</text>
		<view class="tipsbox">
			<text style="color: #f00;" v-if="isTop">置顶</text>
			<text>{{author}}</text>
			<text>{{comments}}评</text>
			<view style="flex: 1; display: flex; justify-content: flex-end;">
				<text>{{time}}</text>
			</view>
		</view>
		<slot name="tips"></slot>
	</view>
</template>

<script>
	export default {
		name:"cardViewText",
		data() {
			return {
			};
		},
		props: {
		  title: {
		    type: String,
		    default: "新闻标题",
		    require: true
		  },
		  isTop: {
		    type: Boolean,
		    default: false,
		    require: true
		  },
		  author: {
		    type: String,
		    default: "来源",
		    require: true
		  },
		  comments: {
		    type: Number,
		    default: 0,
		    require: true
		  },
		  time: {
		    type: String,
		    default: "2025.1.1"
		  }
		},
	}
</script>

<style>
	.cardstyle{
		background-color: aliceblue;
		margin: 10rpx;
		padding: 20rpx;
		border-radius: 10rpx;
	}
	.titlebox {
	  display: block;
	  font-size: 16px;
	  font-weight: bold;
	  color: #333;
	  line-height: 1.4;
	  margin-bottom: 12px;
	  word-wrap: break-word;
	  white-space: normal;
	}
	
	.tipsbox {
	  display: flex;
	  align-items: center;
	  font-size: 12px;
	  color: #999;
	  gap: 12px; 
	}

</style>